
cc.Class({
    extends: cc.Component,

    properties: {
        //添加maskLayer属性
        maskLayer: {
            type: cc.Node,
            default: null
        },
        //添加swooshingAudio属性
        swooshingAudio:{
            default:null,
            url:cc.AudioClip
        }
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start() {

    },
    startGame() {
        //激活背景
        this.maskLayer.active = true;
        //都设置为0
        this.maskLayer.opacity = 0;
        //将背景的颜色切换为黑色
        this.maskLayer.color = cc.Color.BLACK;
        this.maskLayer.runAction(
            cc.sequence(
                cc.fadeIn(0.2),
                cc.callFunc(()=>{
                    console.log('切换场景');
                    cc.director.loadScene('game');
                })
            )
        );
        //加载和切换场景
        cc.audioEngine.playEffect(this.swooshingAudio);
    },

    // update (dt) {},
});
